<?php
session_start();
srand((double)microtime()*1000000);
$number=$_POST['number'];

include_once "function_misc_log.php";
include_once "function_net_misc.php";
$log = array();
if(isset($HTTP_SESSION_VARS["authnum"]))
	if($number != $HTTP_SESSION_VARS["authnum"] || empty($number))
	{
		$log['Info'] = "'Unknow user login system faile.'";
		logger("Login", $log, "Login");
		echo("<meta http-equiv='refresh'content=0;URL='login_image_error.htm'>");   
	}
	else
	{
		$name = $_POST['username'];
		$pass = $_POST['password'];
		$date = date("F j, Y, g:i a");

		include_once "function_auth.php";
		if (CheckSysPassWord($pass, $name))
		{
			$_SESSION['UserName'] = $name;
			$_SESSION['PassWord'] = $pass;
			$_SESSION['LoginTime'] = $date;
			$_SESSION['Flag'] = "Mini";
		
			include_once "function_misc.php";
			$_SESSION['LEVEL'] = GetSystemLicenseLevel();
			include_once "function_admin_manage.php";
			$_SESSION['Right'] = GetXmlAdminRightByUserName($name);
			$_SESSION['Group'] = GetXmlSysSpecialAdminGroup($name);
			$log['Info'] = "'". $name. " login system.'";
			logger("Login", $log, "Login");
			echo("<meta http-equiv='refresh'content=0;URL='index_main.php'>");   
		}
		else
		{
			$log['Info'] = "'User:". $name. " login system faile.'";
			logger("Login", $log, "Login");
			echo("<meta http-equiv='refresh'content=0;URL='login_image_error.htm'>");   
		}	
	}
else
{
	$log['Info'] = "'Unknow user login system faile.'";
	logger("Login", $log, "Login");
	echo("<meta http-equiv='refresh'content=0;URL='login_image_error.htm'>");   
}


?>
